import { request, config } from 'utils';

const { api: { roles } } = config;

export async function createRoleOrGroup (params) {
  return request({
    url: roles.createRoleOrGroup,
    method: 'post',
    data: params,
  });
}

export async function addUsersToRole (params) {
  return request({
    url: roles.addUsersToRole,
    method: 'post',
    data: params,
  });
}

export async function removeUsersFromRole (params) {
  return request({
    url: roles.removeUsersFromRole,
    method: 'post',
    data: params,
  });
}

export async function getUsersInRole (params) {
  return request({
    url: roles.getUsersInRole,
    method: 'get',
    data: params,
  });
}

export async function getAllCanUseRoles (params) {
  return request({
    url: roles.getAllCanUseRoles,
    method: 'get',
    data: params,
  });
}
